import Vue from 'vue'
import VueRouter from 'vue-router'
import Welcome from "@/views/Welcome";
import Console from "@/views/Console";
import Login from "@/views/Login";
import Register from "@/views/Register";
import UserCRUD from "@/components/UserCRUD";
import Index from "@/components/Index";
import ArticleCRUD from "@/components/ArticleCRUD";

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/welcome'
  },
  {
    path: '/welcome',
    component: Welcome
  },
  {
    path: '/console',
    component: Console,
    children: [
      {
        path: 'index',
        component: Index
      },
      {
        path: 'user',
        component: UserCRUD
      },
      {
        path: 'article',
        component: ArticleCRUD
      }
    ]
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/register',
    component: Register
  }
]

const router = new VueRouter({
  routes,
  mode: 'history'
})

export default router
